/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.register.a;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import com.qihoo.gamecenter.sdk.login.plugin.d;
import com.qihoo.gamecenter.sdk.login.plugin.d.a;
import com.qihoo.gamecenter.sdk.login.plugin.h.c;
import com.qihoo.gamecenter.sdk.login.plugin.h.f;

public class a extends AlertDialog {
    private LinearLayout a;
    private LinearLayout b;
    private Context c;
    private Button d;
    private Button e;
    private String f;

    public a(Context paramContext, String paramString) {
        super(paramContext);
        this.c = paramContext;
        this.f = paramString;
        a();
    }

    public void a(View paramView, String paramString) {
        if (paramView == null) {
            TextView localTextView = new TextView(this.c);
            localTextView.setTextSize(1, c.g);
            localTextView.setTextColor(-16777216);
            localTextView.setText(Html.fromHtml((TextUtils.isEmpty(paramString)) ? d.a(d.a.bd) : paramString));
            localTextView.setLineSpacing(10.0F, 1.0F);
            localTextView.setGravity(17);
            paramView = localTextView;
        }
        this.b.addView(paramView, new LinearLayout.LayoutParams(-1, -1));
    }

    public void a(String paramString, a parama) {
        if (TextUtils.isEmpty(paramString)) {
            this.d.setVisibility(8);
            return;
        }
        this.d.setText(paramString);
        this.d.setVisibility(0);
        this.d.setOnClickListener(new View.OnClickListener(parama) {
            public void onClick(View paramView) {
                if (a.this.isShowing())
                    a.this.dismiss();
                if (this.a == null)
                    return;
                this.a.a(paramView);
            }
        });
    }

    public void b(String paramString, a parama) {
        if (!(TextUtils.isEmpty(paramString)))
            this.e.setText(paramString);
        this.e.setVisibility(0);
        this.e.setOnClickListener(new View.OnClickListener(parama) {
            public void onClick(View paramView) {
                if (a.this.isShowing())
                    a.this.dismiss();
                if (this.a == null)
                    return;
                this.a.a(paramView);
            }
        });
    }

    private void a() {
        com.qihoo.gamecenter.sdk.login.plugin.f.a locala = com.qihoo.gamecenter.sdk.login.plugin.f.a.a(this.c);
        this.a = new LinearLayout(this.c);
        int i = f.a(this.c, 20.0F);
        int j = f.a(this.c, 5.0F);
        this.a.setPadding(i, j, i, j);
        locala.a(this.a, -1073741776);
        this.a.setOrientation(1);
        this.b = new LinearLayout(this.c);
        LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(-1, 0);
        localLayoutParams.leftMargin = f.a(this.c, 20.0F);
        localLayoutParams.rightMargin = f.a(this.c, 20.0F);
        localLayoutParams.weight = 1.0F;
        this.a.addView(this.b, localLayoutParams);
        LinearLayout localLinearLayout = new LinearLayout(this.c);
        localLinearLayout.setOrientation(0);
        this.a.addView(localLinearLayout, new LinearLayout.LayoutParams(-1, -2));
        localLayoutParams = new LinearLayout.LayoutParams(0, -2);
        localLayoutParams.weight = 0.5F;
        localLayoutParams.setMargins(7, 5, 7, 5);
        int k = f.a(this.c, 10.0F);
        this.d = new Button(this.c);
        locala.a(this.d, -1073741800, -1073741799, 0);
        this.d.setText(d.a(d.a.b));
        this.d.setVisibility(8);
        this.d.setTextColor(-16777216);
        this.d.setTextSize(1, c.h);
        this.d.setPadding(0, k, 0, k);
        this.d.setTag(Integer.valueOf(1));
        localLinearLayout.addView(this.d, localLayoutParams);
        this.e = new Button(this.c);
        locala.a(this.e, -1073741810, -1073741809, 0);
        this.e.setText(d.a(d.a.a));
        this.e.setTextColor(-1);
        this.e.setTextSize(1, c.h);
        this.e.setTag(Integer.valueOf(2));
        this.e.setPadding(0, k, 0, k);
        localLinearLayout.addView(this.e, localLayoutParams);
    }

    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        this.a.setMinimumHeight(f.a(this.c, 133.0F));
        this.a.setMinimumWidth(f.a(this.c, 295.0F));
        setContentView(this.a, new ViewGroup.LayoutParams(-1, -1));
    }

    public static abstract interface a {
        public abstract void a(View paramView);
    }
}